package com.example.springbootdemo;

/**
 * @Author: zhangrongqing
 * @Date: 2020/2/19 14:48
 */
public class Demo1 {
    private void test1(){
        System.out.println("test111");
    }

    public void test2(){
        System.out.println("test222");
    }

    public static void main(String[] args) {
        Demo1 test1 = new Demo1() {
            public void test1() {
                System.out.println("heihei test1");
            }

            public void test2() {
                System.out.println("heihei test2");
            }
        };

        test1.test1();
        test1.test2();

        Demo2 demo2 = new Demo2();
        demo2.test2();
    }
}

class Demo2 extends Demo1{
    private void test1(){
        System.out.println("demo2:test111");
    }

    public void test2(){
        System.out.println("demo2:test222");
    }
}


